package com.seecen.controller;

import com.seecen.mapper.CompanyMapper;
import com.seecen.service.CompanyService;
import com.seecen.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: p2-end
 * @description:
 * @author: lxk
 * @create: 2025-10-16 14:54
 * @version: 1.0
 **/
@Slf4j
@RestController
@RequestMapping("/company")
@CrossOrigin
public class CompanyContoller {
    @Autowired
    private CompanyService companyService;

    @GetMapping("{companyName}")
    public Result queryCompany(@PathVariable("companyName") String companyName){
        return companyService.selectByCompanyName(companyName);
    }

    @GetMapping("hotCompanyList")
    public Result hotCompanyList(){
        return companyService.selectHotCompanyList();
    }

    /**
     * 获取某个分类下的榜单数据
     * GET /company/ranking/1
     */
    @GetMapping("ranking/{tid}")
    public Result getRankingData(@PathVariable("tid") Integer tid) {
        log.info("获取分类 {} 的榜单数据", tid);
        return companyService.getRankingData(tid);
    }

}
